/*
 * DefaultShader.h
 *
 *  Created on: 24-06-2013
 *      Author: Jarek
 */

#ifndef DEFAULTSHADER_H_
#define DEFAULTSHADER_H_

#include "GlobalData.h"
#include "Shader.h"

class DefaultShader : public Shader {
public:
	GLuint	lightCount;

	struct Uniforms
	{
		GLint modelMatrix;
		GLint viewMatrix;
		GLint projectionMatrix;
		GLint modelViewProjectionMatrix;
		GLint modelInverseTransposeMatrix;
		GLint viewInverseMatrix;
		GLint diffuseTexture;
		GLint textureScale;

		struct LightUniforms
		{
			GLint shadowMapHandle;
			GLint lightMVPMatrix;

			GLint position;
			GLint spotCutoff;
			GLint spotExponent;
			GLint spotDirection;
			GLint constantAttenuation;
			GLint linearAttenuation;
			GLint quadraticAttenuation;
			GLint diffuse;
			GLint specular;
		}*lightUniforms;
	}uniforms;

	struct Attributes
	{
		GLint position;
		GLint normal;
		GLint texCoords;
	}attributes;

public:
	DefaultShader(char* VSPath, char* FSPath, uint lightsCount);
	virtual ~DefaultShader();

	virtual void useAttributes(bool isAtrributes = true);
	virtual void useShaderOnMesh(const Mesh& mesh);
	virtual void draw(const ETime& time, const World& world, View& camera, const Texture* shadowMaps, const uint shadowMapsCount);
	virtual void drawM(const ETime& time, const World& world, Node& node, View& camera);
};

#endif /* DEFAULTSHADER_H_ */
